package 二叉树;


/**
 * https://leetcode.cn/problems/maximum-depth-of-binary-tree/description/?envType=study-plan-v2&envId=top-100-liked
 *
 * 题解：https://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247493344&idx=1&sn=07da6312a384b7635acd58dcda35e2c5&chksm=9bd418e8aca391fe3cab6e6e6100005b632c73d38ce00f5350c8ad4767f688836809e1352eb3&scene=178&cur_album_id=2165089327943417857#rd
 */
public class _104_二叉树的最大深度 {

    public int maxDepth(TreeNode root) {
        if (root == null) return 0;

        int left = maxDepth(root.left);
        int rigth = maxDepth(root.right);

        return Math.max(left,rigth) + 1;
    }
}
